﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;

namespace MachineLearning {
	class ConceptLearner {
		protected XmlToLinq _dataSet;

		protected XElement _currentHypothesis = null;

		public string CurrentHypothesis {
			get {
				string s = "<";
				foreach (XAttribute a in _currentHypothesis.Attributes()) {
					if ((string)a == "Q") s += "?, ";
					else s += (string)a + ", ";
				}
				if (s.Contains("Yes")) {
					s = s.Remove(s.LastIndexOf("Yes,"));
				} else s = s.Remove(s.LastIndexOf(", "));
				s = s.Remove(s.LastIndexOf(", ")) + ">";
				return s;
			}
		}
		protected IEnumerable<XElement> _trainingData = null;
		protected List<XName> _attributeList = null;
		protected XName _targetConcept = null;
		public readonly XName QUESTION = "Q";

		public ConceptLearner() {

		}

		public ConceptLearner(string fileName) {
			_dataSet = new XmlToLinq(fileName);
			_trainingData = _dataSet.Rows;
		}

	}
}
